/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    usart.h
  * @brief   This file contains all the function prototypes for
  *          the usart.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2025 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__
#define __USART_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stdio.h"
#include "string.h"
#include "ymodem.h"
#include "stm32f1xx_hal.h"
/* USER CODE BEGIN Includes */
/* 宏定义 */
#define UART_RX_BUFFER_SIZE 2048
// #define UART_RX_BUFFER_SIZE (YMODEM_PACKET_SIZE_1024+5)
#define YMODEL_SEND_INTERVAL 200    // 200ms发送间隔
#define YMODEL_RECEIVE_TIMEOUT 5000 // 接收超时时间
/* USER CODE END Includes */
extern uint8_t uart_rx_buffer[UART_RX_BUFFER_SIZE];
extern uint16_t uart_rx_length;
extern uint8_t uart_rx_flag;

extern UART_HandleTypeDef huart1;
extern DMA_HandleTypeDef hdma_usart1_rx;
/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_USART1_UART_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __USART_H__ */

